function myInstanceof(left:any,right:Function):boolean{
    if(!left){
        return false
    }
    let __proto__ = Object.getPrototypeOf(left);
    let prototype = right.prototype;
    while(__proto__){
        if(__proto__ === prototype){
            return true
        }
        __proto__ = Object.getPrototypeOf(__proto__);
    }
    return false
}

console.log(myInstanceof(null,Object));
console.log(myInstanceof({a:1},Object));